import machine

ints=0
toint=0
def callbak(pin):
    global ints
    ints=ints+1
    print(ints)
    print(machine.reset_cause())
pin27=machine.Pin(27,machine.Pin.IN,machine.Pin.PULL_UP)
pin27.irq(trigger=machine.Pin.IRQ_FALLING,handler=callbak)

# machine.lightsleep()

